from configure import *
import hashlib
import os
from tqdm import tqdm

def get_true_md5():
    """
        获得正确md5值和错误md5值之间的映射
    """
    print("正在校验样本md5值与样本名的映射")
    res={}
    g = os.walk(all_data_path)  
    for path,dir_list,file_list in g:  
        for file_name in tqdm(file_list):  
            tar = os.path.join(path, file_name) 
            with open(tar, 'rb') as fp:
                data = fp.read()
            file_md5= hashlib.md5(data).hexdigest()
            if file_name!=file_md5:
                res[file_name]=file_md5
    return res

tar=get_true_md5()
print(len(tar))
print(tar)